package com.example.lotterysystem.dao.mapper;

import com.example.lotterysystem.dao.daoobject.Encrypt;
import com.example.lotterysystem.dao.daoobject.UserDO;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {
//    查询邮箱绑定的人数
    @Select("select count(*) from user where email=#{email}")
    int countByMail(@Param("email") String mail);

    @Select("select count(*) from user where phone_number=#{phoneNumber}")
    int countByPhone(@Param("phoneNumber") Encrypt phoneNumber );


    @Insert("insert into user (user_name,phone_number,email,identity,password)"+
    " values(#{userName},#{phoneNumber},#{email},#{identity},#{password})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    void insert(UserDO userDO);
}
